#coding=utf-8
"""
Author:杭州多测师_付佳美
Time:2025/5/9 18:14
website:https://duoceshi.net
"""
import json
json_string = '''
{
    "db_config":{
        "server":"127.0.0.1:3306",
        "db_name":"mysql"
    },
    "sys_config":{
        "listen":"127.0.0.1:8080"
    }
}
'''
data = json.loads(json_string)
print(type(data))
print(data)

import json
with open(r"C:\cms_ui\lesson\data.json",'r') as f:
    data = json.load(f)
print(data)
print(type(data))

import json
dict1 = {'class':{"a":1,'b':2}}
json_string = json.dumps(dict1,indent=4)
print(type(json_string))
print(json_string)

import json
dict1 = {'class':{"a":1,'b':2}}
with open(r'C:\cms_ui\lesson\xiaofu','w') as f:
    json_string = json.dump(dict1,f,indent=4)